<?php
class RaidDrops extends Zend_Db_Table_Abstract {
	protected $_rowClass = 'RaidDropRow';
	protected $_name = 'raid_drops';
	//protected $_dependentTables = array('');
	protected $_referenceMap = array(
		'Items'		=> 	array(
						'columns' 		=> array('item_id'),
						'refTableClass' => 'Items',
						'refColumns' 	=> array('id')
						),
		'RaidKills'	=>	array(
						'columns' 		=> array('raid_kills_id'),
						'refTableClass' => 'RaidKills',
						'refColumns' 	=> array('id')
						),
		'Characters'=>	array(
						'columns' 		=> array('character_id'),
						'refTableClass' => 'Characters',
						'refColumns' 	=> array('id')
						),
		'DkpAdjustments'=> 	array(
						'columns' 		=> array('dkp_adjustment_id'),
						'refTableClass' => 'DkpAdjustments',
						'refColumns' 	=> array('id')
						)
	);
	
/**
	 * Short hand for getting a raid by its id.
	 * 
	 * This function does mysql safe escaping on the raid id.
	 *
	 * @param 	int 			raid id
	 * @return 	RaidDropRow|null
	 */
	public static function getById($raidDropId)
	{	
		// Raid id must be numeric
		if (!is_numeric($raidDropId)) {
			return null;
		}
		
		// Create static self
		$table = new self();
		
		// Create a select for getting the raid
		$select = $table->select()->where("id = ?", $raidDropId);
		$raidDrop = $table->fetchRow($select);
		
		// Return the raid or null
		if ($raidDrop) {
			return $raidDrop;
		} else {
			return null;
		}
	}
}
?>